#include "sm3.h"
#include <stdio.h>
#include <string.h>

int main()
{
    unsigned char std_hash[] = {0x66, 0xc7, 0xf0, 0xf4, 0x62, 0xee, 0xed, 0xd9,
                                0xd1, 0xf2, 0xd4, 0x6b, 0xdc, 0x10, 0xe4, 0xe2,
                                0x41, 0x67, 0xc4, 0x87, 0x5c, 0xf2, 0xf7, 0xa2,
                                0x29, 0x7d, 0xa0, 0x2b, 0x8f, 0x4b, 0xa8, 0xe0};
    unsigned char std_data[] = {0x61, 0x62, 0x63};
    unsigned char hash[SM3_DIGEST_SIZE] = {0};
    SM3_CTX ctx;

    sm3_init(&ctx);
    sm3_update(&ctx, std_data, sizeof(std_data));
    sm3_finish(&ctx, hash);

    if (memcmp(std_hash, hash, SM3_DIGEST_SIZE))
    {
        printf("sm3 failed\n");
    }
    else
    {
        printf("sm3 success\n");
    }

    return 0;
}
